package com.share.example.stock.web;

import com.share.common.common.Result;
import com.share.example.stock.service.IStockMinPriceService;
import com.share.example.stock.service.ITradeDateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * <p>
 * 目标地址: http://quote.eastmoney.com/concept/sh603777.html?from=classic
 * 描述: 东方财富-股票行情-盘前数据
 * 限量: 单次返回指定当前交易日的股票分钟数据, 包含盘前分钟数据
 * symbol	str	symbol="000001"; 股票代码
 * start_date	str	start_date="09:00:00"; 时间; 默认返回所有数据
 * end_date	str	end_date="15:40:00"; 时间; 默认返回所有数据  前端控制器
 * </p>
 *
 * @author author
 * @since 2023-06-10
 */
@RestController
@RequestMapping("/stockminprice")
public class StockMinPriceController {
    @Autowired
    private ITradeDateService iTradeDateService;
    @Autowired
    private IStockMinPriceService iStockMinPriceService;

    @RequestMapping("/down")
    public Result downCurDay() {
        //非工作日直接跳过
        if (!iTradeDateService.isTradeDay(new Date())) {
            return Result.failure("非交易日直接退出");
        }

        Object obj = iStockMinPriceService.downMin();
        return Result.success(obj);
    }
}
